<template>
  <div class="app-container">
    <!--工具栏-->
    <div class="head-container">
      <div>
        <!-- 搜索 -->
        <el-input v-model="query.blurry" clearable size="small" class="filter-item" placeholder="模糊搜索" style="width: 200px;" @keyup.enter.native="crud.toQuery" />
        <el-select
          v-model="query.bisZhsqHljgBm"
          class="filter-item"
          placeholder="所有"
        >
          <el-option
            v-for="item in allHljg"
            :key="item.bisGsglYljgdm"
            :label="item.bisGsglQymc"
            :value="item.bisGsglYljgdm"
            @change="crud.toQuery"
          />
        </el-select>
        <el-select
          v-model="query.bisZhsqHldzSsqx"
          size="small"
          placeholder="所属区县"
          class="filter-item"
          style="width: 150px"
          @change="crud.toQuery"
        >
          <el-option
            v-for="item in dict.ccs"
            :key="item.id"
            :label="item.label"
            :value="item.value"
          />
        </el-select>
        <rrOperation />
      </div>
    </div>
    <!--表格渲染-->
    <el-table
      ref="gkmxTable"
      v-loading="crud.loading"
      :data="crud.data"
      size="small"
      style="width: 100%;"
      @selection-change="crud.selectionChangeHandler"
    >
      <el-table-column align="center" prop="bisZhsqZt" label="申请状态" width="130">
        <template slot-scope="scope">
          <el-tag v-if="scope.row.bisZhsqZt === '05'" effect="plain" type="">
            {{ dict.label.zhzt[scope.row.bisZhsqZt] }}
          </el-tag>
          <el-tag v-else-if="scope.row.bisZhsqZt === '00'" effect="plain" type="warning">
            {{ dict.label.zhzt[scope.row.bisZhsqZt] }}
          </el-tag>
          <el-tag v-else effect="plain" type="danger">
            {{ dict.label.zhzt[scope.row.bisZhsqZt] }}
          </el-tag>
        </template>
      </el-table-column>
      <el-table-column align="center" prop="bisZhsqGrbh" label="人员编号" />
      <el-table-column align="center" prop="bisZhsqYbkh" label="医保卡号" width="90" />
      <el-table-column align="center" prop="bisZhsqSnryXm" label="姓名" />
      <el-table-column align="center" prop="bisZhsqSnryXb" label="性别" />
      <el-table-column align="center" prop="bisZhsqSnrySfz" label="身份证" width="150" />
      <el-table-column align="center" prop="bisZhsqNl" label="年龄" />
      <el-table-column align="center" prop="bisZhsqLxdh" label="联系电话" width="100" />
      <el-table-column align="center" prop="lrsj" label="申请时间" width="150" />
      <el-table-column align="center" prop="bisZhsqHldzSsqx" label="失能老人所属区县">
        <template slot-scope="scope">
          {{ dict.label.ccs[scope.row.bisZhsqHldzSsqx] }}
        </template>
      </el-table-column>
      <el-table-column prop="bisZhsqDykkrq" label="待遇开始日期" width="100" />
      <el-table-column prop="bisZhsqDyjsrq" label="待遇结束日期" width="100" />
      <el-table-column prop="bisZhsqXsdyq" label="享受待遇期" />
      <el-table-column prop="bisZhsqAdl" label="ADL评分" />
      <el-table-column align="center" prop="bisZhsqJhrxm" label="监护人姓名" />
      <el-table-column align="center" prop="bisZhsqJhrdh" label="监护人电话" width="130" />
      <el-table-column align="center" prop="bisZhsqGx" label="关系">
        <template slot-scope="scope">
          {{ dict.label.yjsgx[scope.row.bisZhsqGx] }}
        </template>
      </el-table-column>
      <el-table-column align="center" prop="bisZhsqSnryYbssqx" label="医保所属区县" width="130">
        <template slot-scope="scope">
          {{ dict.label.ccstcqh[scope.row.bisZhsqSnryYbssqx] }}
        </template>
      </el-table-column>
      <el-table-column align="left" prop="bisSbgsQymc" label="商保公司" width="250" />
      <el-table-column align="left" prop="bisHljgQymc" label="护理机构" width="250" />
      <el-table-column prop="bisZhsqHldz" label="地址" width="250" />
    </el-table>
    <!--分页组件-->
    <pagination />
  </div>
</template>

<script>
import crudFpry from '@/api/business/fpry'
import { queryAllHljg } from '@/api/business/hljg'
import CRUD, { presenter, header, form, crud } from '@crud/crud'
import rrOperation from '@crud/RR.operation'
import crudOperation from '@crud/CRUD.operation'
import udOperation from '@crud/UD.operation'
import pagination from '@crud/Pagination'

const defaultForm = { bisZhsqId: null, bisZhsqHljgId: null, bisZhsqSnryId: null, bisZhsqSnryXm: null, bisZhsqSnryXb: null, bisZhsqSnrySfz: null, bisZhsqDykkrq: null, bisZhsqYbkh: null, bisZhsqCbzt: null, bisZhsqDyjsrq: null, bisZhsqXsdyq: null, bisZhsqAdl: null, bisZhsqZt: null, bisZhsqSnryYbssqx: null, ywlx: null, lrr: null, lrrxm: null, lrbm: null, lrbmmc: null, lrsj: null, gxr: null, gxrxm: null, gxbm: null, gxbmmc: null, gxsj: null, sfyx: null, bz: null, bisZhsqAdlPc: null, bisZhsqSndj: null, bisZhsqRybh: null, bisZhsqNl: null, bisZhsqLxdh: null, bisZhsqHldzSsqx: null, bisZhsqHldzXxdz: null, bisZhsqHldz: null, bisZhsqJhrxm: null, bisZhsqJhrdh: null, bisZhsqGx: null, bisZhsqSqyy: null, bisZhsqGrbh: null, adlZhsqs: [] }
export default {
  name: 'Pgcg',
  // eslint-disable-next-line vue/no-unused-components
  components: { pagination, crudOperation, rrOperation, udOperation },
  mixins: [presenter(), header(), form(defaultForm), crud()],
  dicts: ['xb', 'yjsgx', 'ccs', 'zhzt', 'ccstcqh'],
  cruds() {
    return CRUD({ title: '评估人员', url: '/api/home/queryPgcg', idField: 'bisZhsqId', sort: 'lrsj,desc', crudMethod: { ...crudFpry }})
  },
  data() {
    return {
      allHljg: []
    }
  },
  created() {
    this.queryAllHljg()
  },
  methods: {
    // 钩子：在获取表格数据之前执行，false 则代表不获取数据
    [CRUD.HOOK.beforeRefresh]() {
      return true
    },
    // 获取所有护理机构
    queryAllHljg() {
      queryAllHljg().then(res => {
        this.allHljg = res
        console.log(this.allHljg)
      }).catch(() => { })
    }
  }
}
</script>

<style scoped>

</style>
